/*
 * function.c
 *
 *  Created on: 08/mag/2014
 *      Author: Gabriel
 */


#include "strutture.h"


bool coordinate_cmp(const coordinate* a,const coordinate* b){

	bool res=false;

	if (a->x==b->x){
		if (a->y==b->y)
			res=true;
	};

	return res;
}

void coordinate_print(const coordinate* c){
	printf("\nx=%d y=%d\n",c->x,c->y);

	return ;
}

coordinate* coordinate_somma(const coordinate* a,const coordinate* b){
	coordinate* c=(coordinate*)malloc(sizeof(coordinate));

	c->x=a->x+b->x;
	c->y=a->y+b->y;

	return c;
}

coordinate* coordinate_diff(const coordinate* a,const coordinate* b){
	coordinate* c=(coordinate*)malloc(sizeof(coordinate));

	c->x=a->x-b->x;
	c->y=a->y-b->y;

	return c;
}

coordinate* coordinate_prod(const coordinate* a,const coordinate* b){
	coordinate* c=(coordinate*)malloc(sizeof(coordinate));

	c->x=a->x * b->x;
	c->y=a->y * b->y;

	return c;
}


